<template>
	<div class="imgNewStyle" style="margin-top: 20px;">

		<div style="position: relative;width: 85%">
			<el-row>
	
			</el-row>
			<div class="editUserInfo">
				<div style="margin-right: 100px;">
					<span @click="selectAddress()">用户名:</span>
					<span style="color: #0082E6;">{{form.userName}}</span>
				</div>
				<div style="margin-right: 100px;">
					<span>用户名ID:</span>
					<span>{{form.userId}}</span>
				</div>
				<div style="margin-right: 100px;">
					<span>认证类型:</span>
					<span v-if="form.merChantType === 'G'">个体商户</span>
					<span v-if="form.merChantType === 'M'">企业商户</span>
					<span v-if="form.merChantType === '3'">个人商户</span>
				</div>
				<div>
					<span>商家状态:</span>
					<span v-if="form.actStat == '0'">审核中</span>
					<span v-if="form.actStat == '1'">平台拒绝</span>
					<span v-if="form.actStat == '2'">平台通过</span>
					<span v-if="form.actStat == '3'">快捷通拒绝</span>
					<span v-if="form.actStat == '4'">快捷通通过</span>
				</div>
			</div>
			<br>
			<div style="background-color: #FFFFFF;">
				<div style="background: #FFFFFF;;padding: 20px;margin-bottom: 20px;">
					实名认证
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label-width="130px" label="法人姓名：">
						<el-input readonly v-model="form.contact"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="法人身份证：">
						<el-input readonly v-model="form.idCard"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="身份证有效期：">
						<el-date-picker disabled v-model="form.certificatesValidity" value-format="yyyy-MM-dd" type="date" @change="getSTime"
						 placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
					<br>
					<el-form-item label-width="130px" label="联系人手机号：">
						<el-input readonly v-model="form.contactNum"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="联系人邮箱：">
						<el-input readonly v-model="form.email"></el-input>
					</el-form-item>
					<br>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="营业执照号：">
						<el-input readonly v-model="form.merCerNo"></el-input>
					</el-form-item>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="营业执照有效期：">
						<el-date-picker disabled v-model="form.businessLicenseValidity" @change="getValidityTime" type="date" placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
					<el-form-item v-if="form.storeStat === 'M'" label-width="130px" label="组织机构代码号：">
						<el-input readonly v-model="form.organizationCode"></el-input>
					</el-form-item>
					<el-form-item v-if="form.storeStat === 'M'" label-width="130px" label="税务登记证号：">
						<el-input readonly v-model="form.taxRegistryNo"></el-input>
					</el-form-item>
					<br v-if="form.merChantType === 'M' || form.merChantType === 'G'">
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="门店所在地：">
						<el-input readonly v-model="form.areaInfo"></el-input>
						<!-- 	<el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<el-form-item v-if="form.merChantType === 'M' || form.merChantType === 'G'" label-width="130px" label="门店所在地址：">
						<el-input readonly style="width: 400px;" v-model="form.storeAddress"></el-input>
						<!-- <el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<br v-if="form.merChantType === 'M' || form.merChantType === 'G'">
					<el-form-item v-if="form.merChantType === '3'" label-width="130px" label="个人所在地：">
						<el-input readonly v-model="form.areaInfo"></el-input>
						<!-- 	<el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
					<el-form-item v-if="form.merChantType === '3'" label-width="130px" label="个人所在地址：">
						<el-input readonly style="width: 400px;" v-model="form.storeAddress"></el-input>
						<!-- <el-button type="primary" @click="selectAddress()" v-if="form.actStat==3">重新选取地址</el-button> -->
					</el-form-item>
				</el-form>
			</div>
			<br>
			<div style="background-color: #FFFFFF;">
				<div style="background: #FFFFFF;padding: 20px;margin-bottom: 20px;">
					银行卡信息
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label="银行卡类型：" label-width="130px">
						<el-select disabled placeholder="请选择" v-model="form.companyOrPerson" style="width: 192px;text-align: left">
							<el-option label="对公" value="B"></el-option>
							<el-option label="对私" value="C"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="130px" label="银行卡户名：">
						<el-input readonly v-model="form.bankAccountName"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="结算银行卡：">
						<el-input readonly v-model="form.bankAccount"></el-input>
					</el-form-item>
					<br>
					<el-form-item label-width="130px" label="选择开户行：">
						<el-select disabled style="width: 192px;" v-model="form.bankName" placeholder="请选择" @change="changeSelect">
							<el-option v-for="item in cardNameList" :key="item.name" :label="item.name" :value="item.name">
							</el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="130px" label="开户行地区：">
						<el-cascader disabled style="width: 530px;" v-model="value" :options="optionsAddress" @change="handleChangeZone" ref="cascaderAddr"></el-cascader>
					
					</el-form-item>
					<br>
					<el-form-item label-width="130px" label="开户行编号：">
						<el-input readonly v-model="form.headBankCode"></el-input>
					</el-form-item>
					<el-form-item label-width="130px" label="开户支行名称：">
						<el-input readonly style="width: 530px;" v-model="form.bankCode"></el-input>
					</el-form-item>

				</el-form>
			</div>
			<br>
			<div style="background-color: #FFFFFF;">
				<div style="background: #FFFFFF;padding: 20px;margin-bottom: 20px;">
					影印件信息
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item v-if="form.merChantType != '3'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>营业执照:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.businessLicense != ''" :src="form.businessLicense" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							</div>
						</el-form-item>
						<el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>法人身份证正面:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.idcardFront != ''" :src="form.idcardFront" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							<!-- 	<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.idcardFront" :maxCount="1" :maxSize="300*300" @uploading="uploading4"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
						<el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>法人身份证反面:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.idcardBack != ''" :src="form.idcardBack" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
								<!-- <div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.idcardBack" :maxCount="1" :maxSize="300*300" @uploading="uploading5"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
						<!-- <el-form-item v-if="form.merChantType != '3'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>银行开户许可证:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.accountLicense != ''" :src="form.accountLicense" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							</div>
						</el-form-item> -->
						<el-form-item v-if="form.merChantType == 'M'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>组织机构代码证:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.organizationNumber != ''" :src="form.organizationNumber" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
								<!-- <div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.organizationNumber" :maxCount="1" :maxSize="300*300" @uploading="uploading7"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
						<br v-if="form.merChantType != '3'">
						<el-form-item v-if="form.merChantType == 'M'" label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>税务登记证:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.tax != ''" :src="form.tax" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
								<!-- <div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.tax" :maxCount="1" :maxSize="300*300" @uploading="uploading8"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
						<!-- <el-form-item v-if="form.merChantType == '3' || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>手持身份证正面:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.personPhoto != ''" :src="form.personPhoto" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							</div>
						</el-form-item> -->
						<!-- <el-form-item v-if="form.merChantType == '3' || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>手持银行卡:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.bankCardInHand != ''" :src="form.bankCardInHand" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							</div>
						</el-form-item> -->
					<el-form-item v-if="form.merChantType == '3'  || form.merChantType == 'G'">
							<div style="width: 200px;text-align: center;">
								<p>银行卡包含卡号一面:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.bankImage != ''" :src="form.bankImage" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
							<!-- 	<div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.bankImage" :maxCount="1" :maxSize="300*300" @uploading="uploading7"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
					
						<el-form-item label-width="150px">
							<div style="width: 200px;text-align: center;">
								<p>特殊行业资质证明:</p>
								<div style="display: inline-block;text-align: center;width: 90px;height: 90px;">
									<img v-if="form.specialInDustry != ''" :src="form.specialInDustry" alt="" style="width: 90px;height: 90px">
									<div v-else style="display: inline-block;width: 90px;height: 90px;border: 1px solid #999;">
									</div>
								</div>
								<!-- <div style="display: inline-block;text-align: center">
									<we-ui-uploads :images="form.specialInDustry" :maxCount="1" :maxSize="500*500" @uploading="uploading9"></we-ui-uploads>
								</div> -->
							</div>
						</el-form-item>
				</el-form>
			</div>
			<br>
			<div style="background-color: #FFFFFF;">
				<div style="background: #FFFFFF;padding: 20px;margin-bottom: 20px;">
					其他资料
				</div>
				<el-form :inline="true" :model="form" class="demo-form-inline">
					<el-form-item label-width="150px" label="门店全称:">
						<el-input v-if="form.actStat == '4'"  v-model="form.storeName"></el-input>
						<el-input v-else readonly v-model="form.storeName"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="门店简称:">
						<el-input v-model="form.merShortName"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="门店电话:">
						<el-input v-model="form.storePhone"></el-input>
					</el-form-item>
					<br>
					
					<el-form-item label-width="150px" label="商家类型:">
						<el-select v-model="form.storeType" style="width: 192px;" disabled>
							<el-option :label="item.paramName" :value="item.paramKey" v-for="item in typeList"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="150px" label="补贴比例:">
						<el-select v-model="form.storeRebate" style="width: 192px;margin-right: 30px;">
						    <el-option :label="item.text" :value="item.value" v-for="item in scalePublicData"></el-option>
						</el-select>
						<!-- <el-input v-model="form.storeRebate"></el-input> -->
					</el-form-item>
					<el-form-item label-width="150px" label="经营类目:">
						<el-select v-model="form.businessClass" style="width: 200px;" @change="selectSort2()" placeholder="一级分类">
							<el-option :label="item.classifyName" :value="item.classifyId" v-for="(item, index) in sortList" :key="index"></el-option>
						</el-select>
						<el-select v-model="form.businessSubclass" style="width: 200px;" placeholder="二级分类">
							<el-option :label="item.classifyName" :value="item.classifyId" v-for="(item, i) in secondList" :key="i"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label-width="150px" label="营业时间:">
						<el-time-select placeholder="起始时间" v-model="startTime" :picker-options="{
					 	    start: '00:00',
					 	    step: '00:15',
					 	    end: '23:45'
					 	  }">
						</el-time-select>
						<el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{
					 	    start: '00:00',
					 	    step: '00:15',
					 	    end: '23:45'
					 	  }">
						</el-time-select>
					</el-form-item>
					<br>
					<el-form-item v-if="form.actStat === '3' && form.failReason != ''" label-width="150px" label="拒绝理由:">
						<el-input readonly style="width: 600px;" v-model="form.failReason" type="textarea" :rows="2"></el-input>
					</el-form-item>
					<el-form-item label-width="150px" label="商家简介:">
						<el-input style="width: 600px;" v-model="form.introduction" type="textarea" :rows="3"></el-input>
					</el-form-item>
					<br>
					<el-form-item  label-width="150px">
						<div style="width: 200px;text-align: left; margin-left: 78px;font-weight: bold;">
							<p>商家封面图:</p>
							<div style="display: inline-block;text-align: left">
								<we-ui-uploads :images="form.storeImg" :maxCount="1" :maxSize="1024*1024" @uploading="uploading"></we-ui-uploads>
							</div>
						</div>
					</el-form-item>
					<el-form-item label-width="150px">
						<div style="width: 600px;text-align: left;font-weight: bold;">
							<p>商家图片:</p>
							<div>
								<we-ui-uploads :images="form.storegList" :maxCount="9" :maxSize="1024*1024" @uploading="uploading2"></we-ui-uploads>
							</div>

						</div>
					</el-form-item>

				</el-form>
			</div>
			<br>

			<div style="text-align: center;position: fixed;bottom: 20px;left: calc(50% - 40px);background-color: #FFFFFF;">
				<el-button style="width: 300px;" @click="submitForm" type="primary">确定修改信息</el-button>
			</div>
			<div style="width: 100%;height: 50px;"></div>
	
		</div>

		<div class="weui-gallery" style="display: block;z-index: 9999;" v-show="img.is_preview">
			<span class="weui-gallery__img" :style="{backgroundImage:img.preview_url,transform:img.transform}" @click="hidePreview"></span>
			<div class="pre_img" v-if="img.preview_images.length>1" @click="preImg()">
				<img src="../../assets/images/left.png" height="50" width="50">
			</div>
			<div class="next_img" v-if="img.preview_images.length>1" @click="nextImg()">
				<img src="../../assets/images/right.png" height="50" width="50">
			</div>
			<div class="weui-gallery__opr white_pointer">
				<div class="weui-gallery__del" @click.prevent="rotate()">
					<img src="../../assets/images/xuanzhuan.png" height="25" width="25">
					<span class="weui-span_del">旋转</span>
				</div>
			</div>
		</div>
	</div>

</template>
<style>
	.imgNewStyle .weui-uploader__files img {
		width: 80px!important;
		height: auto!important;
	}
</style>

<script>
	import address from '../../address.js'
	export default {
		data() {
			return {
				loading: false,
				arr: [],
				form: {
					storeId: '',
					storeName: '',
					storePhone: '',
					storeAddress: '',
					businessTime: '',
					businessClass: '',
					businessSubclass: '',
					introduction: '',
					businessLicense: '',
					storegList: [],
					storeImg: [],
					storeRebate: '',
					idcardFront: [],
					idcardBack: [],
					accountLicense: [],
					organizationNumber: [],
					tax: [],
					specialInDustry: [],
					bankProvince: '',
					companyOrPerson: '',
					businessLicenseValidity: ''
				},
				radioTime: false,
				businessValidityTime: false,
				oldbusinessLicenseValidity: '',
				oldcertificatesValidity: '',
				newBusinessLicense: [],
				proportionValue: '',
				proportion: [
					{
						text: '2%',
						value: 0.02
					},{
						text: '4%',
						value: 0.04
					}, {
						text: '6%',
						value: 0.06
					},
					{
						text: '8%',
						value: 0.08
					}, {
						text: '10%',
						value: 0.1
					},
					{
						text: '12%',
						value: 0.12
					}, {
						text: '14%',
						value: 0.14
					},
					{
						text: '16%',
						value: 0.16
					}
				],
				value: ['110000', '110100'],
				sortList: [],
				secondList: [],
				startTime: '',
				typeList: [{
					text: '物流商超',
					value: '1'
				}, {
					text: '服务行业',
					value: '2'
				}, {
					text: '酒店',
					value: '3'
				}],
				endTime: '',
				userName: '',
				dialogVisible: false,
				id: '',
				show: '',
				storeImgList: [],
				contactNum: '',
				contact: '',
				cantclick: false,
				msgCode: '',
				img: {
					is_preview: false,
					preview_url: '',
					image_index: null,
					preview_images: [],
					transform: ''
				},
				refuseReason: '',
				stateList: [{
						text: '审核中',
						value: '0'
					},
					{
						text: '平台拒绝',
						value: '1'
					},
					{
						text: '平台通过',
						value: '2'
					},
					{
						text: '快捷通拒绝',
						value: '3'
					},
					{
						text: '快捷通通过',
						value: '4'
					}
				],
				cardNameList: [{
						"name": "农业银行",
						"code": "ABC"
					},
					{
						"name": "中国银行",
						"code": "BOC"
					},
					{
						"name": "建设银行",
						"code": "CCB"
					},
					{
						"name": "工商银行",
						"code": "ICBC"
					},
					{
						"name": "交通银行",
						"code": "COMM"
					},
					{
						"name": "中信银行",
						"code": "CITIC"
					},
					{
						"name": "光大银行",
						"code": "CEB"
					},
					{
						"name": "华夏银行",
						"code": "HXB"
					},
					{
						"name": "民生银行",
						"code": "CMBC"
					},
					{
						"name": "广东发展银行",
						"code": "GDB"
					},
					{
						"name": "平安银行",
						"code": "SZPAB"
					},
					{
						"name": "招商银行",
						"code": "CMB"
					},
					{
						"name": "兴业银行",
						"code": "CIB"
					},
					{
						"name": "浦东发展银行",
						"code": "SPDB"
					},
					{
						"name": "南京银行",
						"code": "NJCB"
					},
					{
						"name": "宁波银行",
						"code": "NBCB"
					},
					{
						"name": "汉口银行",
						"code": "HKBCHINA"
					},
					{
						"name": "杭州银行",
						"code": "HCCB"
					},
					{
						"name": "广州市商业银行",
						"code": "GZCB"
					},
					{
						"name": "浙江稠州商业银行",
						"code": "CZCB"
					},
					{
						"name": "长沙银行",
						"code": "CSCB"
					},
					{
						"name": "城市商业银行",
						"code": "CITYBANK"
					},
					{
						"name": "上海银行",
						"code": "BOS"
					},
					{
						"name": "北京银行",
						"code": "BCCB"
					},
					{
						"name": "晋城市商业银行",
						"code": "SXJS"
					},
					{
						"name": "温州市商业银行",
						"code": "WZCB"
					},
					{
						"name": "广州市农信社",
						"code": "GNXS"
					},
					{
						"name": "农村商业银行",
						"code": "RCB"
					},
					{
						"name": "顺德农信社",
						"code": "SDE"
					},
					{
						"name": "恒丰银行",
						"code": "EGBANK"
					},
					{
						"name": "浙商银行",
						"code": "CZB"
					},
					{
						"name": "农村合作银行",
						"code": "URCB"
					},
					{
						"name": "渤海银行",
						"code": "CBHB"
					},
					{
						"name": "徽商银行",
						"code": "HSBANK"
					},
					{
						"name": "村镇银行",
						"code": "COUNTYBANK"
					},
					{
						"name": "重庆三峡银行",
						"code": "CCQTGB"
					},
					{
						"name": "上海农村商业银行",
						"code": "SHRCB"
					},
					{
						"name": "城市信用合作社",
						"code": "UCC"
					},
					{
						"name": "北京农商行",
						"code": "BJRCB"
					},
					{
						"name": "珠海市农村信用合作社",
						"code": "ZHNX"
					},
					{
						"name": "尧都信用合作联社",
						"code": "YDXH"
					},
					{
						"name": "深圳农村商业银行",
						"code": "SNXS"
					},
					{
						"name": "农村信用合作社",
						"code": "RCC"
					},
					{
						"name": "湖南农信社",
						"code": "HNNXS"
					},
					{
						"name": "中国邮储银行",
						"code": "PSBC"
					},
					{
						"name": "浙江省农村信用社联合社",
						"code": "ZJRC"
					},
					{
						"name": "河南农村信用社",
						"code": "HNNX"
					},
					{
						"name": "江苏农村信用社联合社",
						"code": "JSNX"
					},
					{
						"name": "吉林省农村信用社",
						"code": "JLNLS"
					},
					{
						"name": "河北省农村信用社",
						"code": "HEBNX"
					},
					{
						"name": "内蒙古农村信用社",
						"code": "NMGNXS"
					},
					{
						"name": "辽宁省农村信用社",
						"code": "LNRCC"
					},
					{
						"name": "云南省农村信用社",
						"code": "YNRCC"
					},
					{
						"name": "湖北农村信用社",
						"code": "HBXH"
					},
					{
						"name": "广东农村信用社",
						"code": "GDRC"
					},
					{
						"name": "海南省农村信用社",
						"code": "HNB"
					},
					{
						"name": "山西农村信用社",
						"code": "SXRCU"
					},
					{
						"name": "安徽农村信用社联合社",
						"code": "AHRCU"
					},
					{
						"name": "山东省农村信用社",
						"code": "SDNXS"
					},
					{
						"name": "四川农村信用社",
						"code": "SCRCU"
					},
					{
						"name": "广西农村信用社",
						"code": "GXNXS"
					},
					{
						"name": "陕西农村信用社",
						"code": "SXNXS"
					},
					{
						"name": "福建农村信用社",
						"code": "FJNX"
					},
					{
						"name": "江西农村信用社",
						"code": "JXNXS"
					},
					{
						"name": "贵州农信社",
						"code": "GZRCU"
					},
					{
						"name": "黑龙江农村信用社",
						"code": "HLJRCC"
					},
					{
						"name": "新疆农信社",
						"code": "XJRCCB"
					},
					{
						"name": "青海农信社",
						"code": "QHRCCB"
					},
					{
						"name": "甘肃省农村信用社",
						"code": "GSRCU"
					},
					{
						"name": "浙江民泰商业银行",
						"code": "MTB"
					},
					{
						"name": "哈尔滨银行",
						"code": "HRBCB"
					},
					{
						"name": "中原银行",
						"code": "ZYB"
					},
					{
						"name": "贵阳银行",
						"code": "GYB"
					},
					{
						"name": "郑州银行",
						"code": "ZZBANK"
					},
					{
						"name": "成都银行",
						"code": "BOCD"
					},
					{
						"name": "重庆银行",
						"code": "CQCBANK"
					},
					{
						"name": "青岛银行",
						"code": "QDB"
					},
				],
				optionProps: {
					label: 'label',
					value: 'value',
					children: 'children'
				},
				optionsAddress: address(),
				isMarker: '',
				appData: '',
			}
		},
		created() {
			this.selectSort()
			this.fetchData()
			this.getMarkerInfo()
			this.appData = JSON.parse(sessionStorage.getItem('permission')).appData
			 console.log(sessionStorage.getItem('permission'))
		},
		activated() {

		},
		methods: {
			getMarkerInfo() {
				let data = {
					userId: JSON.parse(sessionStorage.getItem('permission')).adminCode
				}
				
				this.dataApi.ajax('markerRegistration', data, res => {
					if(res.responseType == 'S') {
						this.isMarker = res.isMarker
						console.log(res)
					}
					
				})
			},
			changeChecked() {
				if	(this.radioTime) {
					this.form.certificatesValidity = '2999-01-01'
				}else{
					this.form.certificatesValidity = this.oldcertificatesValidity
				}
			},
			changebusinessTime() {
				if	(this.businessValidityTime) {
					this.form.businessLicenseValidity = '2999-01-01'
				}else{
					this.form.businessLicenseValidity = this.oldbusinessLicenseValidity
				}
			},
			changeSelect(e) {
				this.cardNameList.forEach(item => {
					if(item.name == e) {
						this.form.headBankCode = item.code
					}
				})
			},
			handleChangeZone(e) {

				let str = this.$refs['cascaderAddr'].currentLabels.toString()
				str = str.replace(/,/g, "")
				this.form.bankProvince = str
			},
			fetchData() {
				let userId = JSON.parse(sessionStorage.getItem('permission')).adminCode
				let data = {
					userId: userId
				}
				this.dataApi.ajax('singlemerchantForKjt', data, res => {
					if (res.responseType === 'S') {
						this.form = res
						this.form.storeImg = [this.form.storeImg]
						// if(this.form.idcardBack != '') {
						// 	let str = this.form.idcardBack
						// 	let arr = str.split(',')
						// 	this.form.idcardBack = arr
						// } else{
						// 	this.form.idcardBack = []
						// }
						// if(this.form.businessLicense != ''){
						// 	let businessLicensestr = this.form.businessLicense
						// 	let businessLicensearr = businessLicensestr.split(',')
						// 	this.form.businessLicense = businessLicensearr
						// } else{
						// 	this.form.businessLicense = []
						// }
						// 营业执照
						// if (this.form.businessLicense != '') {
						// 	this.newBusinessLicense.push(this.form.businessLicense)
						// } else {
						// 	this.newBusinessLicense = []
						// }
						// if(this.form.idcardFront != '') {
							
						// 	let idcardFrontstr = this.form.idcardFront
						// 	let idcardFrontarr = idcardFrontstr.split(',')
						// 	this.form.idcardFront = idcardFrontarr
						// } else{
						// 	this.form.idcardFront =  []
						// }
						
						// if(this.form.accountLicense != '') {
						// 	let accountLicensestr = this.form.accountLicense
						// 	let accountLicensearr = accountLicensestr.split(',')
						// 	this.form.accountLicense = accountLicensearr
						// }else{
						
						// 	this.form.accountLicense =  []
							
						// }
						// if (this.form.organizationNumber == '') {
						// 	this.form.organizationNumber = []
						// } else{
						// 	let organizationNumberstr = this.form.organizationNumber
						// 	let organizationNumberarr = organizationNumberstr.split(',')
						// 	this.form.organizationNumber = organizationNumberarr
						// }
						// if(this.form.bankCardInHand != '') {
						// 	let bankCardInHandstr = this.form.bankCardInHand
						// 	let bankCardInHandarr = bankCardInHandstr.split(',')
						// 	this.form.bankCardInHand = bankCardInHandarr
						// } else {
						// 	this.form.bankCardInHand = []
						// }
						// if (this.form.tax == '') {
						// 	this.form.tax = []
						// } else{
						// 	let taxstr = this.form.tax
						// 	let taxarr = taxstr.split(',')
						// 	this.form.tax = taxarr
						// }
						// if (this.form.specialInDustry == '' || this.form.specialInDustry == undefined) {
						// 	this.form.specialInDustry = []
						// } else{
						// 	let specialInDustrystr = this.form.specialInDustry
						// 	let specialInDustryarr = specialInDustrystr.split(',')
						// 	this.form.specialInDustry = specialInDustryarr
						// }
						// if(this.form.personPhoto != '') {
						// 	let personPhotostr = this.form.personPhoto
						// 	let personPhotoarr = personPhotostr.split(',')
						// 	this.form.personPhoto = personPhotoarr
						// } else {
						// 	this.form.personPhoto = []
						// }
						
						// if(this.form.bankImage != ''){
						// 	let bankImagestr = this.form.bankImage
						// 	let bankImagearr = bankImagestr.split(',')
						// 	this.form.bankImage = bankImagearr
						// } else{
						// 	this.form.bankImage = []
						// }
						
						this.storeImgList = generateArr(res.storegList)
						if (this.storeImgList.length > 0) {
							this.form.storeImgList = []
							for (var i = 0; i < this.storeImgList.length; i++) {
								this.form.storegList.push(this.storeImgList[i].imgUrl)
							}
						} else {

						}
						for (let i = this.form.storegList.length - 1; i >= 0; i--) {

							if (this.form.storegList[i] == undefined) {
								this.form.storegList.splice(i, 1);
							}
						}
						if (this.form.businessTime != '') {
							this.startTime = this.form.businessTime.split('-')[0]
							this.endTime = this.form.businessTime.split('-')[1]
						}
						this.getAddressCode()
						this.show = true
					}
				});
			},
			// 获取开户行地区code用于回显
			getAddressCode() {
				var vm = this
				let arrAddress = []
				vm.optionsAddress.forEach(item => {
					if (item.label == vm.form.bankProvince) {
						arrAddress[0] = item.value
						item.children.forEach(ite => {
							if (ite.label == vm.form.bankCity) {
								arrAddress[1] = ite.value
								vm.value = arrAddress
							}
						})
					}
				})
	
			},
			getSTime(val) {
				this.form.certificatesValidity = val
			},
			getValidityTime(val) {
				this.form.businessLicenseValidity = val
			},
			submitForm() {
				if(this.appData != '1') {
					
					if (!this.form.storeName) {
						this.showMsg('请输入商家名称', 'warning')
						return;
					}
					
					if (!this.form.storeAddress) {
						this.showMsg('请选取门店地址', 'warning')
						return;
					}
					
					if (!this.form.businessClass || !this.form.businessSubclass) {
						this.showMsg('请选择分类', 'warning')
						return;
					}
					// if (this.form.storeImg.length == 0) {
					// 	this.showMsg('请上传商家封面图片', 'warning')
					// 	return false;
					// }
					if (this.form.storegList.length < 3 ) {
						this.showMsg('商家图片最低3张', 'warning')
						return false;
					}
				}
				
				// if (this.form.accountLicense.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传银行开户许可证图片', 'warning')
				// 	return false;
				// }
				// if (this.form.organizationNumber.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传组织机构代码证图片', 'warning')
				// 	return false;
				// }
				// if (this.form.tax.length == 0 && this.form.merChantType != '3') {
				// 	this.showMsg('请上传税务登记证图片', 'warning')
				// 	return false;
				// }
				let data = generateObj(this.form)
				this.optionsAddress.forEach(item => {
					if (item.value === this.value[0]) {
						data.bankProvince = item.label
						item.children.forEach(ite => {
							if (ite.value == this.value[1]) {
								data.bankCity = ite.label
							}
						})	
					}
				})
			// 	var arr = data.specialInDustry
			// 	var str = arr.join(',');
			// 	data.specialInDustry = str
			// 	var arr1 = data.tax
			// 	var str1 = arr1.join(',');
			// 	data.tax = str1
			// 	var arr2 = data.organizationNumber
			// 	var str2 = arr2.join(',');
			// 	data.organizationNumber = str2
			// 	var arr3 = data.accountLicense
			// 	var str3 = arr3.join(',');
			// 	data.accountLicense = str3
			// 	var arr4 = data.idcardFront
			// 	var str4 = arr4.join(',');
			// 	data.idcardFront = str4
			// 	var arr5 = data.idcardBack
			// 	var str5 = arr5.join(',');
			// 	data.idcardBack = str5
			// var arr6 = this.newBusinessLicense
			// var str6 = arr6.join(',');
			// data.businessLicense = str6
			// console.log(data.businessLicense,'测试营业执照是否保存')
			// 	if (data.personPhoto.length != 0) {
			// 		var arrpersonPhoto = data.personPhoto
			// 		var strpersonPhoto = arrpersonPhoto.join(',');
			// 		data.personPhoto = strpersonPhoto
			// 	} else{
			// 		data.personPhoto = ''
			// 	}
			// 	if (data.bankCardInHand.length != 0) {
			// 		var arrbankCardInHand = data.bankCardInHand
			// 		var strbankCardInHand = arrbankCardInHand.join(',');
			// 		data.bankCardInHand = strbankCardInHand
			// 	}else{
			// 		data.bankCardInHand = ''
			// 	}
			// 	var arrbankImage = data.bankImage
			// 	var strbankImage = arrbankImage.join(',');
			// 	data.bankImage = strbankImage
				data.storeImg = data.storeImg.toString()
				var storeImgList = []
				for (var i = data.storegList.length - 1; i >= 0; i--) {
					for (var j = this.storeImgList.length - 1; j >= 0; j--) {
						if (this.storeImgList[j].imgUrl == data.storegList[i]) {
							storeImgList.push(this.storeImgList[j].imgUrl)
							break;
						}
					}
				}
				data.storeImgList = storeImgList.reverse()

				for (let i = data.storegList.length - 1; i >= 0; i--) {
					if (data.storegList[i] == undefined) {
						data.storegList.splice(i, 1);
					}
				}
				if (this.startTime && !this.endTime) {
					data.businessTime = this.startTime + '-'
				} else if (this.endTime && !this.startTime) {
					data.businessTime = '-' + this.endTime
				} else if (this.startTime && this.endTime) {
					data.businessTime = this.startTime + '-' + this.endTime
				} else {
					data.businessTime = ''
				}
				data.actStat = '1'
				this.loading = true
				this.dataApi.ajax('merchantEditForKjt', data, res => {
					if (res.responseType === 'S') {
						this.showMsg('保存成功')
						this.radioTime = false
						this.businessValidityTime = false
						this.newBusinessLicense = []
						this.fetchData()
						this.loading = false
						// this.$router.push('/merchant/merchant_list')
					}
				});
			},
			selectSort() {
				this.dataApi.ajax('selectStoreClassify', {
					parentId: 0
				}, res => {
					if (res.responseType === 'S') {
						this.sortList = res.dtos
					}
				});
				this.dataApi.ajax('selectStore', null, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.typeList = res.dtos
					}
				});
			},
			selectSort2() {
				if (this.show) {
					this.form.businessSubclass = this.form.businessSubclass
					this.show = false
				} else {
					this.form.businessSubclass = ''
				}

				this.dataApi.ajax('selectStoreClassify', {
					parentId: this.form.businessClass
				}, res => {
					if (res.responseType === 'S') {
						this.secondList = res.dtos
					}
				});
			},
			uploading(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading3(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading4(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading5(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading6(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.loading = false
					}
				});

			},
			uploading7(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.form.organizationNumber[0] = res.filePath
						this.loading = false
					}
				});

			},
			uploading8(f) {

				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.form.tax[0] = res.filePath
						this.loading = false
					}
				});

			},
			uploading9(f) {
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.form.specialInDustry[0] = res.filePath
						this.loading = false
					}
				});

			},
			uploading2(f) {
				this.loading = true
				this.dataApi.upload('FileUploadNotify/upload', f.file, res => {
					//console.log(res)
					if (res.responseType == 'S') {
						f.images.splice(f.index, 1, res.filePath)
						this.storeImgList.push({
							imgHeight: res.height,
							imgUrl: res.filePath,
							imgWidth: res.width
						})
						this.loading = false
					}
				});

			},
			// selectAddress() {
			// 	this.$router.push('/merchant/map')
			// 	sessionStorage.setItem('keep', '1')
			// },
			// activate() {
			// 	this.dialogVisible = true
			// },
			// find() {
			// 	this.dataApi.ajax('singleUser', {
			// 		userId: this.id
			// 	}, res => {
			// 		if (res.responseType === 'S') {
			// 			this.userName = res.userName
			// 		}
			// 	});
			// },
			// submit() {
			// 	this.loading = true
			// 	this.dataApi.ajax('platformPreliminaryTrial', {
			// 		storeId: this.form.storeId,
			// 		applyStat: 1,
			// 		refuseReason: this.refuseReason
			// 	}, res => {
			// 		if (res.responseType === 'S') {
			// 			this.showMsg('拒绝成功')
			// 			this.dialogVisible = false;
			// 			this.fetchData();
			// 		}
			// 		this.loading = false
			// 	});
			// },
			// findSort(type) {
			// 	for (var i = this.typeList.length - 1; i >= 0; i--) {
			// 		if (type == this.typeList[i].value) {

			// 			return this.typeList[i].text
			// 		}
			// 	}
			// },
			// getcode() {
			// 	if (!this.contactNum) {
			// 		this.showMsg('请输入手机号', 'warning')
			// 		return;
			// 	}
			// 	var _this = this
			// 	var data = {
			// 		phone: this.contactNum,
			// 		yzm: this.contactNum
			// 	}
			// 	this.dataApi.ajax('sendActStoreMsg', data, res => {
			// 		if (res.responseType === 'S') {

			// 			var i = 60;
			// 			var Code = document.getElementById("code");
			// 			var timer = setInterval(function() {
			// 				if (i == 0) {
			// 					Code.innerText = "验证码"
			// 					// Code.style.backgroundColor='#0AC0EF';
			// 					// Code.style.color='white'
			// 					clearInterval(timer)
			// 					_this.cantclick = false

			// 				} else {
			// 					Code.innerText = Math.floor(i) + '秒';
			// 					--i;
			// 					_this.cantclick = true;
			// 				}
			// 			}, 1000);
			// 		}
			// 	})

			// },
			previewImage(src) {
				this.img.is_preview = true;
				this.img.preview_url = `url(${src})`;
				this.img.preview_images = this.images;
				this.img.transform = '';
			},
			previewIdCard(src, index) {
				var arr = []
				for (var key in this.qualificateImgMap) {
					arr[0] = this.form.personPhoto
					arr[1] = this.form.idcardFront
					arr[2] = this.form.idcardBack
					arr[3] = this.form.bankImage
					arr[4] = this.form.businessLicense
				}
				this.img.is_preview = true;
				this.img.preview_url = `url(${src})`;
				this.img.preview_images = arr;
				this.img.transform = '';
				this.img.image_index = index

			},
			hidePreview() {
				this.img.is_preview = false;
				this.img.preview_url = null;
				this.img.image_index = null;
				this.img.preview_images = [];
				this.img.transform = '';
			},
			rotate() {
				if (this.img.transform == '') {
					this.img.transform = 'rotate(90deg)'
				} else if (this.img.transform == 'rotate(90deg)') {
					this.img.transform = 'rotate(180deg)'
				} else if (this.img.transform == 'rotate(180deg)') {
					this.img.transform = 'rotate(270deg)'
				} else if (this.img.transform == 'rotate(270deg)') {
					this.img.transform = ''
				}
			},
			nextImg() {
				this.img.transform = '';
				if (this.img.image_index + 1 == this.img.preview_images.length) {
					this.img.preview_url = `url(${this.img.preview_images[0]})`;
					this.img.image_index = 0;
				} else {
					this.img.preview_url = `url(${this.img.preview_images[this.img.image_index+1]})`;
					this.img.image_index = this.img.image_index + 1;

				}
			},
			preImg() {
				this.img.transform = '';
				if (this.img.image_index == 0) {
					this.img.preview_url = `url(${this.img.preview_images[this.img.preview_images.length-1]})`;
					this.img.image_index = this.img.preview_images.length - 1;
				} else {
					this.img.preview_url = `url(${this.img.preview_images[this.img.image_index-1]})`;
					this.img.image_index = this.img.image_index - 1;

				}
			},
			// agree() {
			// 	this.dataApi.ajax('platformPreliminaryTrial', {
			// 		storeId: this.form.storeId,
			// 		applyStat: 2
			// 	}, res => {
			// 		if (res.responseType === 'S') {
			// 			this.showMsg("通过成功")
			// 			this.fetchData();
			// 		}
			// 	})
			// }
		}
	}
</script>
<style>
	.editUserInfo {
		display: flex;
		justify-content: flex-start;
		padding: 20px;
		background-color: #FFFFFF;
		margin-top: 20px;
		
	}
</style>
